package cate.game.play.skill.active;

import cate.common.table.d.GDAttr;
import cate.game.attr.FightAttr;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;

/**
 * 目标每携带一个负面状态，技能伤害提升6%
 */
public class 冷血追魂AH extends ActiveHandler{

	private double 伤害提升;

	//伤害提升=600
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		伤害提升 = args.getDouble("伤害提升", 0d);
	}

	@Override
	public void parseExt(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		伤害提升 += args.getDouble("伤害提升", 0d);
	}

	@Override
	public void beforeSingleEffect(SkillActionCtx action, SkillEffect effect, Fighter target) {
		int buffNum = target.buff.countBuff(b -> !b.isGood());
		if (buffNum > 0) {
			effect.getTargetCtx(target.getPid()).
					addActorAttr(new FightAttr(GDAttr.DAMAGE_ADD, buffNum * 伤害提升));
		}
	}
}
